package com.blue.waffle.iwc.ui;

import java.util.List;

import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.ui.Image;

public class Blank extends Image
{    
    private int letterIndex;
    private boolean isEmpty;
    private Rectangle blankRect;
    private char expectedLetter;
    private boolean correct;
    private char filledLetter;
    
	public Blank(float x, float y, TextureRegion region, int letterIndex, char letter)
    {
		super(region);
    	this.setPosition(x, y);
    	blankRect = new Rectangle(x, y, region.getRegionWidth(), region.getRegionHeight());
    	this.letterIndex = letterIndex;
    	isEmpty = true;
    	this.correct=false;
    	this.setExpectedLetter(letter);
    }
    
	public static void reset(List<Blank> blanks){
		if (blanks!=null) {
			for (Blank blank : blanks) {
				blank.setEmpty(true);
			}
		}
	}
	
    public int getLetterIndex() {
		return letterIndex;
	}

	public void setLetterIndex(int letterIndex) {
		this.letterIndex = letterIndex;
	}

	public boolean isEmpty() {
		return isEmpty;
	}

	public void setEmpty(boolean isEmpty) {
		this.isEmpty = isEmpty;
	}
	
	public Rectangle getBlankRect() {
		return blankRect;
	}

	public char getExpectedLetter() {
		return expectedLetter;
	}

	public void setExpectedLetter(char expectedLetter) {
		this.expectedLetter = expectedLetter;
	}
	
	public boolean isCorrect() {
		correct=expectedLetter==filledLetter;
		return correct;
	}

	public char getFilledLetter() {
		return filledLetter;
	}

	public void setFilledLetter(char filledLetter) {
		this.filledLetter = filledLetter;
	}
}